// comment.js
Page({
  data: {
    productRate: 0,
    serviceRate: 0,
    logisticsRate: 0,
    otherServiceRate: 0,
    comment: '',
    fileList: []
  },

  onProductRateChange(event) {
    this.setData({
      productRate: event.detail
    });
  },

  onServiceRateChange(event) {
    this.setData({
      serviceRate: event.detail
    });
  },

  onLogisticsRateChange(event) {
    this.setData({
      logisticsRate: event.detail
    });
  },

  onOtherServiceRateChange(event) {
    this.setData({
      otherServiceRate: event.detail
    });
  },

  onCommentInput(event) {
    this.setData({
      comment: event.detail.value
    });
  },

  afterRead(event) {
    const { file } = event.detail;
    const { fileList } = this.data;
    fileList.push({ ...file, url: file.path });
    this.setData({ fileList });
  },

  onDelete(event) {
    const { index } = event.detail;
    const { fileList } = this.data;
    fileList.splice(index, 1);
    this.setData({ fileList });
  },

  onSubmit() {
    const {
      productRate,
      serviceRate,
      logisticsRate,
      otherServiceRate,
      comment,
      fileList
    } = this.data;

    // 提交逻辑
    console.log({
      productRate,
      serviceRate,
      logisticsRate,
      otherServiceRate,
      comment,
      fileList
    });
  }
});
